import java.util.*;
public class lk2055 {
    public static void main(String[] args) {
        String s="**|**|***|";
        int queries[][]= {{2,5},{5,9}};
        System.out.println(Arrays.toString(platesBetweenCandles(s, queries)));
        
    }
    public static int[] platesBetweenCandles(String s, int[][] queries) {
        int n=s.length();
        char a[]=s.toCharArray();
        int n1=queries.length;
        int b[]=new int[n1];
        int y=0;
        for(int i=0;i<n1;i++){
            int count=0;
            int left=queries[i][0];
            int right=queries[i][1];
            if(left<right){
                while(a[left]!='|'){
                    left++;
                }
                while(a[right]!='|'){
                    right--;
                }
                for(int j=left+1;j<right;j++){
                    if(a[j]=='*'){
                        count++;
                    }
                }
                b[y]=count;
                y++;
            }
        }
        return b;
    }
}
